#!/usr/bin/python
# -*- coding: UTF-8 -*-
import sys;
sys.path.append("..")
sys.path.append("../../")
from lib.BwRobotLib import BwRobotLib
from RobotSpider.SpiderRobot import SpiderRobot
import keyboard
import time

robotlib = BwRobotLib()
spiderRobot = SpiderRobot(robotlib)

#连接机器人设备
#robotlib.connectRobot("10.10.100.254",8899)
robotlib.connectRobot("192.168.3.46",55000)

#加载配置（兼容VS项目启动方式及文件直接启动方式）
import os,inspect
fileName = inspect.getframeinfo(inspect.currentframe()).filename
folderPath     = os.path.dirname(os.path.abspath(fileName))
cfile=folderPath+"/config.txt"
robotlib.loadConfig(cfile)

#配置ID
spiderRobot.bindIds(robotlib.module_ids)

#-----------------------------------------------------------------------------
#仿生蜘蛛
#-----------------------------------------------------------------------------

print("Enter any key to initialize....")
input("")
spiderRobot.quickInit()
while(1):
  print("Enter any key to run ....")
  input("")
  spiderRobot.runDemo()


